#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "DirectedRelationship.h"
#include "VisibilityKind.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Namespace;
class PackageableElement;

/// <summary>
/// ElementImport
/// An ElementImport identifies a NamedElement in a Namespace other than the one
/// that owns that NamedElement and allows the NamedElement to be referenced using
/// an unqualified name in the Namespace owning the ElementImport.
/// </summary>
class UMLMODEL_EXPORT ElementImport : public DirectedRelationship {

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Methods
    /// <summary>
    /// getName
    /// The query getName() returns the name under which the imported PackageableElement
    /// will be known in the importing namespace.
    /// </summary>
    virtual QString getName() const;

public: // Properties
    /// <summary>
    /// alias getter
    /// Specifies the name that should be added to the importing Namespace in lieu of
    /// the name of the imported PackagableElement. The alias must not clash with any
    /// other member in the importing Namespace. By default, no alias is used.
    /// </summary>
    QString alias() const;

    /// <summary>
    /// alias setter
    /// Specifies the name that should be added to the importing Namespace in lieu of
    /// the name of the imported PackagableElement. The alias must not clash with any
    /// other member in the importing Namespace. By default, no alias is used.
    /// </summary>
    void setAlias(const QString& value);

    /// <summary>
    /// importedElement getter
    /// Specifies the PackageableElement whose name is to be added to a Namespace.
    /// </summary>
    shared_ptr<PackageableElement> importedElement() const;

    /// <summary>
    /// importedElement setter
    /// Specifies the PackageableElement whose name is to be added to a Namespace.
    /// </summary>
    void setImportedElement(shared_ptr<PackageableElement> value);

    /// <summary>
    /// importingNamespace getter
    /// Specifies the Namespace that imports a PackageableElement from another
    /// Namespace.
    /// </summary>
    shared_ptr<Namespace> importingNamespace() const;

    /// <summary>
    /// importingNamespace setter
    /// Specifies the Namespace that imports a PackageableElement from another
    /// Namespace.
    /// </summary>
    void setImportingNamespace(shared_ptr<Namespace> value);

    /// <summary>
    /// visibility getter
    /// Specifies the visibility of the imported PackageableElement within the
    /// importingNamespace, i.e., whether the  importedElement will in turn be visible
    /// to other Namespaces. If the ElementImport is public, the importedElement will be
    /// visible outside the importingNamespace while, if the ElementImport is private,
    /// it will not.
    /// </summary>
    VisibilityKind visibility() const;

    /// <summary>
    /// visibility setter
    /// Specifies the visibility of the imported PackageableElement within the
    /// importingNamespace, i.e., whether the  importedElement will in turn be visible
    /// to other Namespaces. If the ElementImport is public, the importedElement will be
    /// visible outside the importingNamespace while, if the ElementImport is private,
    /// it will not.
    /// </summary>
    void setVisibility(VisibilityKind value);

private: // Fields
    /// <summary>
    /// alias
    /// Specifies the name that should be added to the importing Namespace in lieu of
    /// the name of the imported PackagableElement. The alias must not clash with any
    /// other member in the importing Namespace. By default, no alias is used.
    /// </summary>
    const static QString alias_default_;
    QString alias_= alias_default_;

    /// <summary>
    /// importedElement
    /// Specifies the PackageableElement whose name is to be added to a Namespace.
    /// </summary>
    shared_ptr<PackageableElement> importedElement_;

    /// <summary>
    /// importingNamespace
    /// Specifies the Namespace that imports a PackageableElement from another
    /// Namespace.
    /// </summary>
    shared_ptr<Namespace> importingNamespace_;

    /// <summary>
    /// visibility
    /// Specifies the visibility of the imported PackageableElement within the
    /// importingNamespace, i.e., whether the  importedElement will in turn be visible
    /// to other Namespaces. If the ElementImport is public, the importedElement will be
    /// visible outside the importingNamespace while, if the ElementImport is private,
    /// it will not.
    /// </summary>
    VisibilityKind visibility_ = VisibilityKind::kpublic;

};

} // namespace uml
